home *** CD-ROM | disk | FTP | other *** search
-
- #import "ThreshOperator.h"
-
- @implementation ThreshOperator
-
- - (const char*) operatorName
- {
- return "Threshold";
- }
-
- - openPanel
- {
- [self loadInterface:"threshold.nib"];
- return [super openPanel];
- }
-
- - processImage:(unsigned short*) data
- withWidth:(int)width height:(int) height
- minValue:(unsigned short) minValue andMaxValue:(unsigned short) maxValue
- {
- unsigned int low= [threshForm intValueAt:0];
- unsigned int high= [threshForm intValueAt:1];
- unsigned int inValue= [threshForm intValueAt:2];
- unsigned int v;
- int i;
- int count = width*height;
-
- if (inValue == 0)
- for (i= 0; i<count; i++){
- v= data[i];
- if (v < low || v>high) v= 0;
- data[i]= v;
- }
- else
- for (i= 0; i<count; i++){
- v= data[i];
- if (v < low || v>high) v= 0; else v= (int)inValue;
- data[i]= v;
- }
- return self;
- }
- @end
-